# coding=utf-8
# @Time   : 2023/11/26
# @Author : wangjl
# @Email  : 1975039138@qq.com
from datetime import datetime, timedelta

DATE_PATTERN = "%Y%m%d"
DATETIME_PATTERN = "%Y-%m-%d %H:%M:%S"


def get_now_datetime(fmt) -> str:
    return datetime.now().strftime(fmt)


def add_date(dt, days, pattern=DATE_PATTERN) -> str:
    dt = datetime.strptime(dt, pattern)
    dt = dt + timedelta(days=days)
    return dt.strftime(pattern)


now_date = get_now_datetime(DATE_PATTERN)
now_datetime = get_now_datetime(DATETIME_PATTERN)


if __name__ == '__main__':
    print(add_date(now_date, -1))
